#include "WPILib.h"

/**joystick test program
 */
class RobotDemo : public SimpleRobot
{
	RobotDrive *myArm;
	Joystick *joy;
	//Joystick *joy2;
	DriverStation *ds;			// driver station object for getting selections
	
	//joystick variables
	int buttonNum;
	bool joyOutput;

public:
	/*
	 * RobotDemo constructor
	 * This code creates instances of the objects and sets up the driving directions
	 * for the RobotDrive object. Our robot was geared such that we had to invert
	 * each of them motor outputs. You may not need to do that
	 */
	RobotDemo() {
		ds = DriverStation::GetInstance();	// driver station instance for digital I/O
		joy = new Joystick(1);
		//joy2 = new Joystick(2);
		myArm = new RobotDrive(7, 8);
	}
	/**
	 * This function is called once each time the robot enters autonomous mode.
	 */
	void Autonomous() {
		// stop driving when finished
	}

	/**
	 * This function is called once each time the robot enters operator control.
	 */
	void OperatorControl() {
		while(IsOperatorControl())
		{
			readJoystick();
			myArm -> ArcadeDrive(joy); 
		}
	}
		
	/**
		read joystick buttons
	*/
		void readJoystick(void)
	{
	for(buttonNum = 1; buttonNum <= 16; buttonNum++)
	{
		joyOutput = joy -> GetButton(buttonNum);
		if(joyOutput == true){printf(" %d", buttonNum);}
	}
	}//end readJoystick
};

START_ROBOT_CLASS(RobotDemo)
;

